package com.tanhua.manage.job;

import com.tanhua.manage.service.AnalysisByDayService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * 定时任务类
 */
@Component
@Slf4j
public class AnalysisJob {

    @Autowired
    private AnalysisByDayService analysisByDayService;

    @Scheduled(cron = "0/5 * * * * ?")  // 从第0秒开始，每隔5秒执行一次
    public void analysis(){
        log.info("定时任务开始执行...");
        analysisByDayService.anasysis();
        log.info("定时任务执行完毕...");
    }
}
